package com.check.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.check.dao.AgencyDao;
import com.check.dao.WorkRoleDao;
import com.check.pojo.MarkWorkRole;
import com.check.pojo.Org;
import com.check.pojo.PageObject;
import com.check.pojo.WorkRole;

@Repository("agencyDao")
public class AgencyDaoImpl  extends BaseSqlMapDao implements AgencyDao{

	
	public List<Org> findAllOrg(Map map) {
		return getSqlMapClientTemplate().queryForList("Org.findOrgByPage",map);
	}

	public Org findOrgById(String o_id) {
		
		return (Org) getSqlMapClientTemplate().queryForObject("Org.findOrgById",o_id);
	}
	
	public void insertOrg(Org org){
		insertObject("Org.insertOrg", org);
	}

	public void updateOrg(Org org) {
		updateObject("Org.updateOrg",org);
		
	}

	public void deleteOrg(String o_id) {
		deleteObject("Org.deleteOrg", o_id);
	}

	public List<Org> findAllOrgByUpId(Map map){
		return getSqlMapClientTemplate().queryForList("Org.findAllOrgByUpId",map);
	}
	
	public int findOrgCount(){
		int count=((Integer) getSqlMapClientTemplate().queryForObject("Org.findOrgCount")).intValue();
		return count;
	}
	
	public List<Org> findAllOrgByType(String o_type){
		return getSqlMapClientTemplate().queryForList("Org.findAllOrgByType", o_type);
	}
	
	public List<Org> findAllOrgRoomByUpId(String o_upid){
		return getSqlMapClientTemplate().queryForList("Org.findAllOrgRoomByUpId", o_upid);
	}
	
	public List<Org> findAllFirstLevelDept(){
		return getSqlMapClientTemplate().queryForList("Org.findAllFirstLevelDept");
	}
	
	public List<Org> findAllNextLevelDept(String o_upid){
		return getSqlMapClientTemplate().queryForList("Org.findAllNextLevelDept",o_upid);
	}
	
	public void deleteOprOfOrg(String orgId){
		deleteObject("Opr.deleteOprOfOrg",orgId);
	}

	public List<Org> findAllCurrentAndNextOrg(String o_id) {
		return getSqlMapClientTemplate().queryForList("Org.findAllCurrentAndNextOrg",o_id);
	}

	public List<Org> findAllOrgByOprId(String oprId) {
		return getSqlMapClientTemplate().queryForList("Org.findAllOrgByOprId",oprId);
	}

	public List<Org> findAllOrgTreeByOprId(Org org) {
		return getSqlMapClientTemplate().queryForList("Org.findAllOrgTreeByOprId",org);
	}

	public List<Org> findFirstLevelOrgId(String oprId) {
		return getSqlMapClientTemplate().queryForList("Org.findFirstLevelOrg",oprId);
	}

	public List<Org> findAllCurrentAndNextOrg(Map orgMap) {
		return getSqlMapClientTemplate().queryForList("Org.findAllCurrentAndNextOrgByPage",orgMap);
	}

	public int findAllCurrentAndNextOrgCount(String deptId) {
		int count=((Integer) getSqlMapClientTemplate().queryForObject("Org.findAllCurrentAndNextOrgCount",deptId)).intValue();
		return count;
	}

}
